// 全局变量
var carousel;
var recoHouseTitle;
var houseinfo;

// 页面加载请求ajax
$.ajax({
    type: "post",
    async: false,
    url: "/airbnb/getCarouselList.do",
    dataType: "json",
    error: function () {
        alert("轮播图的ajax请求失败");
    },
    success: function (response) {
        carousel = response;
    }
});

$.ajax({
    type: "post",
    async: false,
    url: "/airbnb/getRecoHouseTitle.do",
    dataType: "json",
    error: function () {
        alert("推荐房源标题的ajax请求失败");
    },
    success: function (response) {
        recoHouseTitle = response;
    }
});

$.ajax({
    type: "post",
    async: false,
    url: "/airbnb/getRecoHouseList.do",
    dataType: "json",
    error: function () {
        alert("推荐房源的ajax请求失败");
    },
    success: function (response) {
        houseinfo = response;
    }
});

// 页面模版
var parent_carousel = new Vue({
    el: '.carousel',
    data: {
        carousel: carousel
    }
});

var recohouse = new Vue({
    el: '.wjc-three-layout',
    data: {
        maintitle: recoHouseTitle.maintitle,
        subtitle: recoHouseTitle.subtitle,
        area: [
            {
                id: 0,
                city: '上海'
            }, {
                id: 1,
                city: '成都'
            }, {
                id: 2,
                city: '杭州'
            }, {
                id: 3,
                city: '丽江'
            }, {
                id: 4,
                city: '苏州'
            }, {
                id: 5,
                city: '武汉'
            }, {
                id: 6,
                city: '珠海'
            }, {
                id: 7,
                city: '广州'
            }
        ],
        houseinfo: houseinfo
    }
});

var recostory = new Vue({
    el: '.wjc-story',
    data: {
        stories: [
            {
                rslink: 'http://www.baidu.com/',
                city: '厦门',
                title: '在鬧中取靜的「家」，感受廈門的美好和治癒',
                icon: 'img/9863e63e-d8a0-4f4c-a381-05aebdcc49d1.jpg',
                znum: 473,
                commNum: 70,
                url: 'img/77b86d57-4ee6-4be4-8b22-089e49607b4e.jpg',
                stname: '房源'
            },  {
                rslink: 'http://www.baidu.com/',
                city: '厦门',
                title: '在鬧中取靜的「家」，感受廈門的美好和治癒',
                icon: 'img/9863e63e-d8a0-4f4c-a381-05aebdcc49d1.jpg',
                znum: 473,
                commNum: 70,
                url: 'img/77b86d57-4ee6-4be4-8b22-089e49607b4e.jpg',
                stname: '房源'
            },  {
                rslink: 'http://www.baidu.com/',
                city: '厦门',
                title: '在鬧中取靜的「家」，感受廈門的美好和治癒',
                icon: 'img/9863e63e-d8a0-4f4c-a381-05aebdcc49d1.jpg',
                znum: 473,
                commNum: 70,
                url: 'img/77b86d57-4ee6-4be4-8b22-089e49607b4e.jpg',
                stname: '房源'
            },  {
                rslink: 'http://www.baidu.com/',
                city: '厦门',
                title: '在鬧中取靜的「家」，感受廈門的美好和治癒',
                icon: 'img/9863e63e-d8a0-4f4c-a381-05aebdcc49d1.jpg',
                znum: 473,
                commNum: 70,
                url: 'img/77b86d57-4ee6-4be4-8b22-089e49607b4e.jpg',
                stname: '房源'
            },  {
                rslink: 'http://www.baidu.com/',
                city: '厦门',
                title: '在鬧中取靜的「家」，感受廈門的美好和治癒',
                icon: 'img/9863e63e-d8a0-4f4c-a381-05aebdcc49d1.jpg',
                znum: 473,
                commNum: 70,
                url: 'img/77b86d57-4ee6-4be4-8b22-089e49607b4e.jpg',
                stname: '房源'
            },  {
                rslink: 'http://www.baidu.com/',
                city: '厦门',
                title: '在鬧中取靜的「家」，感受廈門的美好和治癒',
                icon: 'img/9863e63e-d8a0-4f4c-a381-05aebdcc49d1.jpg',
                znum: 473,
                commNum: 70,
                url: 'img/77b86d57-4ee6-4be4-8b22-089e49607b4e.jpg',
                stname: '房源'
            },  {
                rslink: 'http://www.baidu.com/',
                city: '厦门',
                title: '在鬧中取靜的「家」，感受廈門的美好和治癒',
                icon: 'img/9863e63e-d8a0-4f4c-a381-05aebdcc49d1.jpg',
                znum: 473,
                commNum: 70,
                url: 'img/77b86d57-4ee6-4be4-8b22-089e49607b4e.jpg',
                stname: '房源'
            },  {
                rslink: 'http://www.baidu.com/',
                city: '厦门',
                title: '在鬧中取靜的「家」，感受廈門的美好和治癒',
                icon: 'img/9863e63e-d8a0-4f4c-a381-05aebdcc49d1.jpg',
                znum: 473,
                commNum: 70,
                url: 'img/77b86d57-4ee6-4be4-8b22-089e49607b4e.jpg',
                stname: '房源'
            }
        ]
    }
});

